#include "infoui.h"
#include "constants.h"
#include "ui_infoui.h"

InfoUI::InfoUI(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::InfoUI)
{
    ui->setupUi(this);
    setWindowFlags(this->windowFlags() | Qt::FramelessWindowHint );

    //set font color
    QPalette pe;
    pe.setColor(QPalette::WindowText, Qt::blue);
    ui->info->setPalette(pe);
    //button style
    QPalette btnPe;
    btnPe.setColor(QPalette::ButtonText, Qt::white);
    ui->btnOk->setStyleSheet(greenBtn);
    ui->btnNo->setStyleSheet(blueBtn);
    ui->btnYes->setStyleSheet(greenBtn);
    ui->btnOk->setPalette(btnPe);
    ui->btnNo->setPalette(btnPe);
    ui->btnYes->setPalette(btnPe);
}

InfoUI::~InfoUI()
{
    delete ui;
}

void InfoUI::SetInfo(QString title, QString info)
{
    ui->title->setText(title);
    ui->info->setText(info);
}

void InfoUI::InfoDialog()
{
    ui->btnNo->hide();
    ui->btnYes->hide();
    ui->btnOk->show();
}

void InfoUI::QuestionDialog()
{
    ui->btnNo->show();
    ui->btnYes->show();
    ui->btnOk->hide();
}

void InfoUI::on_btnOk_clicked()
{
    done(1);
}

void InfoUI::on_btnNo_clicked()
{
    done(0);
}

void InfoUI::on_btnYes_clicked()
{
    done(1);
}
